/**
 * 日志告警配置DTO
 * 作者：GodMainCode
 * 创建时间：2024-01-17
 * 修改时间：2024-01-17
 * 修改人：GodMainCode
 */

import { IsString, IsInt, IsEnum, IsOptional, Min, IsArray } from 'class-validator';
import { ApiProperty } from '@nestjs/swagger';
import { LogType, LogLevel } from '../../../interfaces/log.interface';

export class LogAlertConfigDto {
  @ApiProperty({ description: '告警名称' })
  @IsString()
  name: string;

  @ApiProperty({ description: '告警类型', enum: LogType })
  @IsEnum(LogType)
  type: LogType;

  @ApiProperty({ description: '告警级别', enum: LogLevel })
  @IsEnum(LogLevel)
  level: LogLevel;

  @ApiProperty({ description: '告警阈值', minimum: 1 })
  @IsInt()
  @Min(1)
  threshold: number;

  @ApiProperty({ description: '告警时间窗口(分钟)', minimum: 1 })
  @IsInt()
  @Min(1)
  timeWindow: number;

  @ApiProperty({ description: '告警通知方式', example: ['email', 'webhook'] })
  @IsArray()
  @IsString({ each: true })
  notifyChannels: string[];

  @ApiProperty({ description: '告警通知接收者', required: false })
  @IsArray()
  @IsString({ each: true })
  @IsOptional()
  receivers?: string[];

  @ApiProperty({ description: 'Webhook地址', required: false })
  @IsString()
  @IsOptional()
  webhookUrl?: string;
} 